package com.modules.utils;

import java.util.Random;

/**
 * Created by lewis on 2017/7/29.
 */
public class RandomStringGenerator {
    static final String base = "abcdefghijklmnopqrstuvwxyz0123456789";
    public static String getRandomStringByLength(int length) {

         Random random = new Random();
         StringBuffer sb = new StringBuffer();
         for (int i = 0; i < length; i++) {
             int number = random.nextInt(base.length());
             sb.append(base.charAt(number));
         }
         return sb.toString();
    }
}

